<template>
    <div class="app-container">
         <div style="text-align: center;">
            <!-- 入职流程图片 -->
             <img src="http://192.168.3.11:8086/image/technology/70289c9b631f4fdca3779afb92e0a7d8.png" height="200px">
         </div>
        <el-steps v-if="this.createForm.type == 11" :active="ferState" align-center>
          <el-step title="开始" description=""></el-step>
          <el-step title="新员工入职培训" description=""></el-step>
          <el-step title="岗前培训" description=""></el-step>
          <el-step title="考核" description=""></el-step>
          <el-step title="岗位培训" description=""></el-step>
          <el-step title="考核" description=""></el-step>
          <el-step title="岗位实操培训" description=""></el-step>
          <el-step title="考核" description=""></el-step>     
          <el-step title="颁发上岗证" description=""></el-step>
          <el-step title="回写MES信息" description=""></el-step>
          <el-step title="结束" description=""></el-step>
        </el-steps>
        <el-steps v-if="this.createForm.type == 111" :active="ferState" align-center>
          <el-step title="开始" description=""></el-step>
          <el-step title=""></el-step>
          <el-step title=""></el-step>
          <el-step title="老员工定期培训" description=""></el-step> 
          <el-step title="岗位培训" description=""></el-step>
          <el-step title="考核" description=""></el-step>
          <el-step title="结束" description=""></el-step>
        </el-steps>
        <el-steps v-if="this.createForm.type == 1111" :active="ferState" align-center>
          <el-step title="开始" description=""></el-step>
          <el-step title="外部老师培训" description=""></el-step> 
          <el-step title="专业培训" description=""></el-step>
          <el-step title="考核" description=""></el-step>
          <el-step title="结束" description=""></el-step>
        </el-steps>
        <div style="margin: 5px 0 5px 50px;display: flex;">
            <el-link style="font-size: 20px;margin-right: 10px;" :underline="false" target="_blank">基础信息</el-link>
            <!-- <el-button type="primary">批量导入</el-button>   -->
            <el-upload
            class="upload-demo"
            ref="upload"
            :action="action"
            :on-success="handleSuccess"
            :file-list="fileList"
            :headers="httpHeader"   
            :auto-upload="false"
            >
              <el-button slot="trigger" size="small" type="primary">批量导入</el-button>
              <div style="display: inline;">
                <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
                <!-- <el-button type="primary" @click="addTrain">添加培训人</el-button>  -->
              </div>
            </el-upload>
        </div>  
        <div>
            <el-form :inline="true" :model="createForm"  :rules="rules" ref="createForm">
                <div style="display: flex; ">
                    <el-form-item label="姓名" prop="userName" label-width="100px">
                        <el-input disabled v-model="createForm.userName" autosize  style="width: 120px"/>
                    </el-form-item>
                    <el-form-item label="工号" prop="jobNumber" label-width="100px" >
                        <el-input disabled v-model="createForm.jobNumber" autosize style="width: 120px"/>
                    </el-form-item>
                    <el-form-item label="部门" prop="workCenter" label-width="100px" >
                        <el-input disabled v-model="createForm.workCenter" autosize style="width: 120px"/>
                    </el-form-item>
                    <el-form-item label="岗位类别" prop="jobCategory" label-width="100px" >
                        <el-input disabled v-model="createForm.jobCategory" autosize style="width: 120px"/>
                    </el-form-item>
                    <el-form-item label="岗位名称" prop="jobTitle" label-width="120px" >
                        <el-input disabled v-model="createForm.jobTitle" autosize style="width: 120px"/>
                    </el-form-item>
                </div>
                <div style="display: flex;">
                    <el-form-item label="岗位级别" prop="rankOfPosition" label-width="100px" >
                        <el-select 
                             v-model="createForm.rankOfPosition" 
                             clearable      
                             filterable
                             disabled
                             style="width: 120px"
                             class="ul-item">
                             <el-option :value="item" :label="item" v-for="(item,index) in this.centerList" :key="index"/>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="直接主管" prop="parentName" label-width="100px" >
                        <el-input disabled v-model="createForm.parentName" autosize style="width: 120px"/>
                        <!-- <el-select disabled v-model="createForm.parentName" placeholder="" style="width:120px">
                            <el-option :value="item.id" :label="item.jobTitle" v-for="(item,index) in this.jobTitleList" :key="index"/>
                        </el-select>     -->
                    </el-form-item>
                    <el-form-item label="培训类别" prop="trainingCategory" label-width="100px">
                        <el-input disabled v-model="createForm.trainingCategory" autosize style="width: 120px"/>

                        <!-- <el-select disabled style="width: 120px;" clearable filterable v-model="createForm.trainingCategory" placeholder="" class="ul-item">
                            <el-option :value="item.userName" :label="item.userName" v-for="(item,index) in this.userList" :key="index"/>
                        </el-select> -->
                    </el-form-item>   
                    <el-form-item label="入职时间" prop="entryTime" label-width="100px" >
                        <el-input disabled v-model="createForm.entryTime" autosize style="width: 180px"/>
                        <!-- <el-select clearable filterable disabled v-model="createForm.entryTime" placeholder="" style="width:170px">
                          <el-option :value="item" :label="item" v-for="(item,index) in this.jobCategoryList" :key="index"/>
                        </el-select> -->
                    </el-form-item>     
                </div>
            </el-form>
            <div style="display:flex;justify-content:space-between">
                <!-- pagination 分页 -->
                <div style="display: flex; justify-content: center; padding: 10px 0">
                  <span style="line-height: 28px; font-size: 13px"
                    >本次培训共 {{ total }} 人 </span>
                  <el-pagination
                    background
                    @current-change="handleCurrentChange"
                    :current-page="currentPage1"
                    :page-size="1"
                    layout="prev, pager, next"
                    small
                    :total="total"
                  >
                  </el-pagination>
                  <div>
                    <el-select clearable filterable v-model="tiemJobNumber" style="width: 120px">
                      <el-option :value="item.jobNumber" :label="item.userName" v-for="(item,index) in this.getUserList" :key="index"/>
                    </el-select>
                    <el-button type="primary" @click="searchName">搜索</el-button>
                </div>
                </div>
                <div  v-if="createForm" style="margin-right: 460px;">
                    <span style="margin-right: 20px">发起人：{{createForm.updateUserName  }}</span>
                    <span>处理时间：{{createForm.updateTime ? createForm.updateTime:createForm.createTime}}</span>
                </div>
            </div>
        </div>
        <!-- 入职培训 -->
        <div v-if="this.createForm.type == 11">
            <div style="margin: 5px 0 5px 50px; display: flex; justify-content:space-between">
                <div>
                    <el-link style="font-size: 20px;margin-right: 10px;" :underline="false" target="_blank">入职培训</el-link>
                    <el-button type="primary" :disabled="ferState != 0" @click="trainingClick('入职培训')">培训计划维护</el-button>      
                    <!-- <el-button :disabled="GQbool" type="primary" @click="trainingClick('入职培训')">培训计划维护</el-button>       -->
                </div>
                <el-button :disabled="ferState != 1" style="margin-right: 200px;" type="success"  size="medium" @click="skipTrain('入职培训')">完成培训</el-button>
            </div>
            <el-table :data="entryList" element-loading-text="给我一首歌的时间" stripe border fit highlight-current-row style="width: 100%;margin-top:15px;">
                <el-table-column  label="序号" type="index" align="center" width="80px"/>
                <el-table-column label="培训内容"  prop="trainingContent" align="center"/>
                <el-table-column label="内容类别"  prop="contentType" align="center"/>
                <el-table-column label="培训讲师"  prop="trainingInstructor" align="center"/>
                <el-table-column label="培训时间"  prop="trainingTime" align="center"/>
                <el-table-column label="考核方式"  prop="evaluationMode" align="center"/>
                <el-table-column label="培训记录"  prop="trainingPhoto" align="center">
                    <template slot-scope="scope" >  
                      <el-link style="font-size: 12px" :href="scope.row.trainingPhoto" target="_blank">{{scope.row.trainingPhoto}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="考核记录"  prop="assessmentData" align="center">
                    <template slot-scope="scope" >  
                      <el-link style="font-size: 12px" :href="scope.row.assessmentData" target="_blank">{{scope.row.assessmentData}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="效果评价"  prop="effectivenessEvaluation" align="center"/>
            </el-table> 
            <div v-if="tableInfo.length" style="display:flex;justify-content:space-between">
                <div></div>
                <div style="margin-right: 460px;">
                    <span style="margin-right: 20px">培训人：{{tableInfo[0].trainingInstructor }}</span>
                    <span>处理时间：{{tableInfo[0].updateTime ? tableInfo[0].updateTime:tableInfo[0].createTime}}</span>
                </div>
            </div>
        </div>
        <!-- 岗前培训 -->
        <div v-if="this.createForm.type == 11">
            <div style="margin: 5px 0 5px 50px; display: flex; justify-content:space-between">
                <div>
                    <el-link style="font-size: 20px;margin-right: 10px;" :underline="false" target="_blank">岗前培训</el-link>
                    <el-button type="primary" :disabled="ferState != 2" @click="trainingClick('岗前培训')">培训计划维护</el-button>      
                    <!-- <el-button :disabled="GQbool" type="primary" @click="trainingClick('岗前培训')">培训计划维护</el-button>       -->
                </div>
                <el-button :disabled="ferState != 3" style="margin-right: 200px;" type="success"  size="medium" @click="skipTrain('岗前培训')">完成培训</el-button>
            </div>
            <el-table :data="tableInfo" element-loading-text="给我一首歌的时间" stripe border fit highlight-current-row style="width: 100%;margin-top:15px;">
                <el-table-column  label="序号" type="index" align="center" width="80px"/>
                <el-table-column label="培训内容"  prop="trainingContent" align="center"/>
                <el-table-column label="内容类别"  prop="contentType" align="center"/>
                <el-table-column label="培训讲师"  prop="trainingInstructor" align="center"/>
                <el-table-column label="培训时间"  prop="trainingTime" align="center"/>
                <el-table-column label="考核方式"  prop="evaluationMode" align="center"/>
                <el-table-column label="培训记录"  prop="trainingPhoto" align="center">
                    <template slot-scope="scope" >  
                      <el-link style="font-size: 12px" :href="scope.row.trainingPhoto" target="_blank">{{scope.row.trainingPhoto}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="考核记录"  prop="assessmentData" align="center">
                    <template slot-scope="scope" >  
                      <el-link style="font-size: 12px" :href="scope.row.assessmentData" target="_blank">{{scope.row.assessmentData}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="效果评价"  prop="effectivenessEvaluation" align="center"/>
            </el-table> 
            <div v-if="tableInfo.length" style="display:flex;justify-content:space-between">
                <div></div>
                <div style="margin-right: 460px;">
                    <span style="margin-right: 20px">培训人：{{tableInfo[0].trainingInstructor }}</span>
                    <span>处理时间：{{tableInfo[0].updateTime ? tableInfo[0].updateTime:tableInfo[0].createTime}}</span>
                </div>
            </div>
        </div>
        <!-- 岗位培训 -->
         <div  v-if="this.createForm.type != 1111">
             <div style="margin: 5px 0 5px 50px; display: flex; justify-content:space-between">
                 <div>
                <el-link style="font-size: 20px; margin-right: 10px;" :underline="false" target="_blank">岗位培训</el-link>
                <!-- <el-button type="primary" @click="trainingClick('岗位培训')">培训计划维护</el-button>       -->
                <el-button :disabled="ferState != 4" type="primary" @click="trainingClick('岗位培训')">培训计划维护</el-button>  
            </div>
            <!-- <el-button style="margin-right: 200px;" type="success" size="medium" @click="skipTrain('岗位培训')">完成培训</el-button> -->
            <el-button :disabled="ferState != 5" style="margin-right: 200px;" type="success" size="medium" @click="skipTrain('岗位培训')">完成培训</el-button>
            </div>
            <el-table :data="tableData" element-loading-text="给我一首歌的时间" stripe border fit highlight-current-row style="width: 100%;margin-top:15px;">
                <el-table-column  label="序号" type="index" align="center" width="80px"/>
                <el-table-column label="培训内容"  prop="trainingContent" align="center"/>
                <el-table-column label="内容类别"  prop="contentType" align="center"/>
                <el-table-column label="培训讲师"  prop="trainingInstructor" align="center"/> 
                <el-table-column label="培训时间"  prop="trainingTime" align="center"/>
                <el-table-column label="考核方式"  prop="evaluationMode" align="center"/>
                <el-table-column label="培训记录"  prop="trainingPhoto" align="center">
                    <template slot-scope="scope" >  
                      <el-link style="font-size: 12px" :href="scope.row.trainingPhoto" target="_blank">{{scope.row.trainingPhoto}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="考核记录"  prop="assessmentData" align="center">
                    <template slot-scope="scope" >  
                      <el-link style="font-size: 12px" :href="scope.row.assessmentData" target="_blank">{{scope.row.assessmentData}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="效果评价"  prop="effectivenessEvaluation" align="center"/>
            </el-table> 
            <div v-if="tableData.length" style="display:flex;justify-content:space-between">
                <div></div>
                <div style="margin-right: 460px;">
                    <span style="margin-right: 20px">培训人：{{tableData[0].trainingInstructor  }}</span>
                    <span>处理时间：{{tableData[0].updateTime ? tableData[0].updateTime:tableData[0].createTime}}</span>
                </div>
            </div>
        </div>
        <!-- 岗位实操培训 -->
        <div v-if="this.createForm.type == 11">
             <div style="margin: 5px 0 5px 50px; display: flex; justify-content:space-between">
                 <div>
                    <el-link style="font-size: 20px; margin-right: 10px;" :underline="false" target="_blank">岗位实操培训</el-link>
                    <!-- <el-button type="primary" @click="trainingClick('岗位实操培训')">培训计划维护</el-button>       -->
                    <el-button :disabled="ferState != 6" type="primary" @click="trainingClick('岗位实操培训')">培训计划维护</el-button>  
                </div>
            <!-- <el-button style="margin-right: 200px;" type="success" size="medium" @click="skipTrain('岗位实操培训')">完成培训</el-button> -->
            <el-button :disabled="ferState != 7" style="margin-right: 200px;" type="success" size="medium" @click="skipTrain('岗位实操培训')">完成培训</el-button>
            </div>  
            <el-table :data="tableList" element-loading-text="给我一首歌的时间" stripe border fit highlight-current-row style="width: 100%;margin-top:15px;">
                <el-table-column  label="序号" type="index" align="center" width="80px"/>   
                <el-table-column label="培训内容"  prop="trainingContent" align="center"/>
                <el-table-column label="内容类别"  prop="contentType" align="center"/>
                <el-table-column label="培训讲师"  prop="trainingInstructor" align="center"/> 
                <el-table-column label="培训时间"  prop="trainingTime" align="center"/>
                <el-table-column label="考核方式"  prop="evaluationMode" align="center"/>
                <el-table-column label="培训记录"  prop="trainingPhoto" align="center">
                    <template slot-scope="scope" >  
                      <el-link style="font-size: 12px" :href="scope.row.trainingPhoto" target="_blank">{{scope.row.trainingPhoto}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="考核记录"  prop="assessmentData" align="center">
                    <template slot-scope="scope" >  
                      <el-link style="font-size: 12px" :href="scope.row.assessmentData" target="_blank">{{scope.row.assessmentData}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="效果评价"  prop="effectivenessEvaluation" align="center"/>
            </el-table>
            <div v-if="tableList.length" style="display:flex;justify-content:space-between">
                <div></div>
                <div style="margin-right: 460px;">
                    <span style="margin-right: 20px">培训人：{{tableList[0].updateUserName  }}</span>
                    <span>处理时间：{{tableList[0].updateTime ? tableList[0].updateTime:tableList[0].createTime}}</span>
                </div>
            </div>
        </div>
        <!-- 专业培训 -->
        <div  v-if="this.createForm.type == 1111">
             <div style="margin: 5px 0 5px 50px; display: flex; justify-content:space-between">
                 <div>
                <el-link style="font-size: 20px; margin-right: 10px;" :underline="false" target="_blank">专业培训</el-link>
                <!-- <el-button type="primary" @click="trainingClick('专业培训')">培训计划维护</el-button>       -->
                <el-button :disabled="ferState != 4" type="primary" @click="trainingClick('专业培训')">培训计划维护</el-button>  
            </div>
            <!-- <el-button style="margin-right: 200px;" type="success" size="medium" @click="skipTrain('专业培训')">完成培训</el-button> -->
            <el-button :disabled="ferState != '专业'" style="margin-right: 200px;" type="success" size="medium" @click="skipTrain('专业培训')">完成培训</el-button>
            </div>
            <el-table :data="tableData" element-loading-text="给我一首歌的时间" stripe border fit highlight-current-row style="width: 100%;margin-top:15px;">
                <el-table-column  label="序号" type="index" align="center" width="80px"/>
                <el-table-column label="培训内容"  prop="trainingContent" align="center"/>
                <el-table-column label="内容类别"  prop="contentType" align="center"/>
                <el-table-column label="培训讲师"  prop="trainingInstructor" align="center"/> 
                <el-table-column label="培训时间"  prop="trainingTime" align="center"/>
                <el-table-column label="考核方式"  prop="evaluationMode" align="center"/>
                <el-table-column label="培训记录"  prop="trainingPhoto" align="center">
                    <template slot-scope="scope" >  
                      <el-link style="font-size: 12px" :href="scope.row.trainingPhoto" target="_blank">{{scope.row.trainingPhoto}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="考核记录"  prop="assessmentData" align="center">
                    <template slot-scope="scope" >  
                      <el-link style="font-size: 12px" :href="scope.row.assessmentData" target="_blank">{{scope.row.assessmentData}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="效果评价"  prop="effectivenessEvaluation" align="center"/>
            </el-table> 
            <div v-if="tableData.length" style="display:flex;justify-content:space-between">
                <div></div>
                <div style="margin-right: 460px;">
                    <span style="margin-right: 20px">培训人：{{tableData[0].updateUserName  }}</span>
                    <span>处理时间：{{tableData[0].updateTime ? tableData[0].updateTime:tableData[0].createTime}}</span>
                </div>
            </div>
        </div>

        <!-- 选择培训计划 -->
        <el-dialog title="选择培训计划" center :visible.sync="trainingShow" width="60%">
            <el-table :data="trainingList" element-loading-text="给我一首歌的时间" stripe border fit 
            highlight-current-row style="width: 100%;margin-top:15px;" :cell-style="{ textAlign: 'center' }"
            :header-cell-style="{ textAlign: 'center' }"
            default-expand-all
            @selection-change="SelectionChange2"
            @select="selectRow2">
                <el-table-column type="selection" width="70" align="center"></el-table-column>
                <!-- <el-table-column  label="序号" type="index" align="center" width="50px"/> -->
                <el-table-column label="培训内容"  prop="trainingContent" align="center" width="200"/>
                <el-table-column label="内容类别"  prop="contentType" align="center"/>
                <el-table-column label="导师/讲师"  prop="userName" align="center"/>
                <el-table-column label="培训类别"  prop="trainingCategory" align="center"/>
                <el-table-column label="培训岗位"  prop="trainingObjectsStr" align="center"/>
                <el-table-column label="考核方式"  prop="evaluationMode" align="center" width="200px"/>
            </el-table>
        <div slot="footer" class="dialog-footer">
            <el-button @click="trainingShow = false">取 消</el-button>
            <el-button type="primary" @click="trainingAffirm" :loading="printLoading">确 认</el-button>
        </div>
        </el-dialog>

        <div v-if="this.createForm.type == 11">
            <div style="margin: 5px 0 5px 50px;">
                <el-link style="font-size: 20px;margin-right: 10px;" :underline="false" target="_blank">颁发上岗证</el-link>
                <el-button :disabled="ferState != 8" @click="mountGuard" type="primary">打印上岗证</el-button>      
            </div>
            <!-- <div v-if="createForm" style="display:flex;justify-content:space-between">
               <div></div>
                <div style="margin-right: 460px;">
                    <span style="margin-right: 20px">处理人：{{createForm.updateUserName  }}</span>
                    <span>处理时间：{{createForm.updateTime ? createForm.updateTime:createForm.createTime}}</span>
                </div>
            </div> -->
        </div>
        <el-dialog title="员工上岗打印" center @close="startingName = ''" :visible.sync="dialogFormVisible" width="60%">
            <div style="margin: 5px 0 5px 50px;">
                <el-link style="margin-right: 50px;" :underline="false" target="_blank">获取上岗证清单</el-link>
                <el-input  clearable filterable v-model="startingName" placeholder="员工姓名获取" autosize style="width: 120px"/>
                <el-button type="primary" @click="inquireName">查 询</el-button>
            </div>
            <el-table :data="StartingList" element-loading-text="给我一首歌的时间" stripe border fit 
            highlight-current-row style="width: 100%;margin-top:15px;" :cell-style="{ textAlign: 'center' }"
            :header-cell-style="{ textAlign: 'center' }"
            default-expand-all
            @selection-change="SelectionChange1"
            @select="selectRow1">
                <el-table-column type="selection" width="70" align="center"></el-table-column>
                <el-table-column  label="序号" type="index" align="center" width="50px"/>
                <el-table-column label="姓名"  prop="userName" align="center"/>
                <el-table-column label="工号"  prop="jobNumber" align="center"/>
                <el-table-column label="部门"  prop="departmentName" align="center"/>
                <el-table-column label="岗位类别"  prop="jobCategory" align="center"/>
                <el-table-column label="所在岗位"  prop="jobTitle" align="center"/>
                <!-- <el-table-column label="关键岗位"  prop="" align="center"/> -->
                <el-table-column label="岗位级别"  prop="rankOfPosition" align="center">
                  <template slot-scope="scope" >
                      {{ scope.row.rankOfPosition == 1 ? '试用级' 
                      :scope.row.rankOfPosition == 2 ? '初级'
                      :scope.row.rankOfPosition == 3 ? '中级'
                      :scope.row.rankOfPosition == 4 ? '高级'
                      :scope.row.rankOfPosition == 5 ? '师傅级':'-' }}
                  </template>
                </el-table-column>
                <el-table-column label="入职时间"  prop="entryTime" align="center"/>
                <el-table-column label="所会岗位"  prop="userJobTitle" align="center"/>
            </el-table> 
            <div style="margin:  0;">
            <el-select
                clearable
                v-model="printerName" 
                placeholder="请选择打印机"
                style="margin-right: 20px"
                >
                <el-option 
                :value="item" 
                :label="item" v-for="(item,index) in this.printerNameList" 
                :key="index"/>
            </el-select>
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="modify" :loading="printLoading">打 印</el-button>
            <el-button type="primary" @click="processPDF" :loading="printLoading1">导出pdf</el-button>
          <el-button @click="dialogFormVisible = false">取 消</el-button>
        </div>
        </el-dialog>
    </div>
</template>

<script>
import { transferSave,knowledgeFind,programFind,recordSave,recordSaveList,userKnowledgeRecordState,recordFind,findByUser,word04,word04Download } from "@/api/knowledgeSkill"
import { searchWorkers,userPageJobNumberList } from '@/api/chargingData'
import { updateUserKnowledge } from '@/api/user'
import { findZplPrinterInfoList } from '../../api/orderAndMachine'
import {uploadURL} from '@/utils/baseURL'
import mixin from '@/utils/mixin.js'
export default {
    name: 'inductionTraining',
    mixins: [mixin],
    data () {   
        return {
            createForm:{
                userName:'',
                jobNumber:'',
                originalWorkCenter:'',
                originalJobCategory:'',
                originalJobTitle:'',
                originalUserName:'',
                originalParentNumber:'',
                nowWorkCenter:'',
                nowJobCategory:'',
                nowJobTitle:'',
                nowUserName:'',
                nowParentNumber:'',
            },
            rules: {
              userName: [
                { required: true, message: '姓名不能为空', trigger: 'blur' }
              ],
              jobNumber: [
                { required: true, message: '工号不能为空', trigger: 'blur' }
              ],
              originalWorkCenter: [
                { required: true, message: '原工作中心不能为空', trigger: 'blur' }
              ],
              originalJobCategory: [
                { required: true, message: '原岗位类别不能为空', trigger: 'blur' }
              ],
              originalJobTitle: [
                { required: true, message: '原岗位名称不能为空', trigger: 'blur' }
              ],
              originalUserName: [
                { required: true, message: '原直接主管不能为空', trigger: 'blur' }
              ],
              originalParentNumber: [
                { required: true, message: '原直接主管工号不能为空', trigger: 'blur' }
              ],
              nowWorkCenter: [
                { required: true, message: '新工作中心不能为空', trigger: 'blur' }
              ],
              nowJobCategory: [
                { required: true, message: '新岗位类别不能为空', trigger: 'blur' }
              ],
              nowJobTitle: [
                { required: true, message: '新岗位名称不能为空', trigger: 'blur' }
              ],
              nowUserName: [
                { required: true, message: '新直接主管不能为空', trigger: 'blur' }
              ],
              nowParentNumber: [
                { required: true, message: '新直接主管工号不能为空', trigger: 'blur' }
              ],
            },
            action: uploadURL + `/back/user-knowledge-record/UserKnowledgeRecordEntryExcel`,
            fileList: [],
            httpHeader: {
          'Authorization': ''
      },
            tiemJobNumber:'',
            userInfo:{},
            jobTitleList:[],
            tableInfo:[],           //岗前培训列表
            tableData:[],           //岗位培训列表
            tableList:[],
            currentPage1:0,
            total:0, 
            ferState:1,
            GQbool: true,
            GWbool: true,
            allBool: false,        // 全部禁用
            userList: [], 
            getUserList:[],            // 获取转岗人列表
            jobCategoryList: ['1线','1.5线','2线'], 
            dialogFormVisible: false,
            StartingList:[],       // 上岗人员列表
            startingName:'',
            printerName: '',
            printerNameList: [],
            rowSelect1:[],         // 选择列表
            printLoading: false,
            printLoading1: false,
            entryList:[],           // 入职培训列表
            trainingShow: false,    // 选择培训计划弹框
            trainingList:[],        // 培训计划列表
            rowSelect2:[],          // 培训计划选择列表
            trainingCategory: '',   // 培训类别
            arrfilter:[]
        }
    },
    computed: {
    },
    watch: {
      '$route'(to, from) {
        // 重置组件状态 
        this.handleFilter();
      }
    },
    methods: { 
        selectRow1(selection, row) {
          console.log("单选", selection, row)
          this.rowSelect1 = selection;
        },
        SelectionChange1(select){
          console.log("全选",select)
          this.rowSelect1 = select;
        },
        selectRow2(selection, row) {
          console.log("单选", selection, row)
          this.rowSelect2 = selection;
        },
        SelectionChange2(select){
          console.log("全选",select)
          this.rowSelect2 = select;
        },
        // 名字搜索
        searchName(){
            this.handleFilter()
        },
        // 点击查询
        async inquire(){    
            this.arrfilter = this.getUserList.filter(item => {
                if(item.state == 8){
                    return item
                }
            })
            const arrr = this.arrfilter.map(item => item.jobNumber)
            let query = {}
            console.log('arrr',arrr)
            query.jobNumberList = arrr.join(',')
            if(this.startingName){ query.username = this.startingName }
            const res = await userPageJobNumberList(query)
            let arr = []
            this.getUserList.forEach(item1 => {
                res.data.forEach(item2 =>{
                    if(item1.jobNumber == item2.jobNumber && item1.state == 8){
                        arr.push(item1)
                    }
                })
            })
            this.upStaff(arr)
        },
        async upEmployee(arr){
            arr.forEach(async item =>{
                let query = {   
                    status: 1,
                    jobNumber: item.jobNumber,  
                    userKnowledgePostId: item.userKnowledgePostId,
                }
                await updateUserKnowledge(query)
            })
        },
        // 修改员工所在岗位和 所会岗位
        async upStaff(arr){
            await this.upEmployee(arr)
            await this.inquireName()
        },
        async inquireName(){
            let arr1 =[]
            const arrfilter = this.getUserList.filter(item => {
                if(item.state == 8){
                    return item
                }
            })
            const arrr = arrfilter.map(item => item.jobNumber)
            let query = {}
            query.jobNumberList = arrr.join(',')
            if(this.startingName){
                query.userName = this.startingName
                // delete query.jobNumberList
            }
            setTimeout(async () =>{
                const res = await userPageJobNumberList(query)
                arr1 = res.data
                this.getStarting(arr1)
            },600)
        },
        // 点击上岗
        async mountGuard(){
            this.StartingList = []
            // 获取打印机列表
            this.getPrinter()
            this.dialogFormVisible = true
            this.inquire()
        },
        getStarting(arr) {
            this.StartingList = []  
            console.log('arr',arr[0])
            this.StartingList = arr.map(item =>({
                userName: item.userName,
                jobNumber: item.jobNumber,
                departmentName: item.departmentName,
                entryTime: item.entryTime,
                jobCategory: item.userKnowledgePost.jobCategory,
                jobTitle: item.userKnowledgePost.jobTitle,
                rankOfPosition: item.userKnowledgePost.rankOfPosition,
                userJobTitle: item.jobTitleList.map(user => user.jobTitle).join(','),
            }))
        },
        // 下载pdf
        async processPDF(){
            if(!this.rowSelect1.length) return this.$message.error('请选择列表！')
            let jobNumberList = this.rowSelect1.map(item => item.jobNumber)
            let query = {
                jobNumberList: jobNumberList,
            }
            this.printLoading1 = true
            const res = await word04Download(query)
            this.printLoading1 = false
            const errMsg = res.data.message
            if(res.data.code == '500') return
            if(res.data.code != '1') return this.$message.error(errMsg)
            this.$message.success(errMsg)
            // 自动下载
            window.location.href = res.data.results
            await userKnowledgeRecordState({jobNumbers: jobNumberList,state:'结束'})
            this.handleFilter()
            this.dialogFormVisible = false
        },
        // 点击打印
        async modify(){
            if(!this.rowSelect1.length) return this.$message.error('请选择打印列表！')
            if(!this.printerName) return this.$message.error('请选择打印机！')
            let jobNumberList = this.rowSelect1.map(item => item.jobNumber)
            let query = {
                util:'单',
                printerName: this.printerName,
                jobNumberList: jobNumberList,
            }
            this.printLoading = true
            const res = await word04(query)
            this.printLoading = false
            if(res.code != 1) return this.$message.error(res.msg)
            await userKnowledgeRecordState({jobNumbers: jobNumberList,state:'结束'})
            this.handleFilter()
            this.$message.success('打印成功！')
            this.dialogFormVisible = false
        },
        submitUpload() {
        //  this.httpHeader.Authorization = this.dealCookie(document.cookie)
         this.httpHeader.Authorization = this.$store.state.user.token,
         this.$refs.upload.submit()
         },
         // 上传成功
         handleSuccess(response){
          if(response.code == 1){
            this.fileList = []
            this.$message.success(response.msg)
          } else {
            this.$message.error(response.msg)
          }
            this.handleFilter()
        },
        // 点击添加培训人
        addTrain(){
            this.allBool = false
            this.createForm = {}
            this.ferState = 1
            this.$refs['createForm'].resetFields()
        },
         // 获取个人信息
         async getuserList(e){  
            let query = {page:1,limit:9999,status:1} 
            console.log(e)
            this.userList = []
            if(e == 1){
                if(this.createForm.userName){
                    query.username = this.createForm.userName
                }
            }else if(e == 2){
                if(this.createForm.nowUserName){
                    query.username = this.createForm.nowUserName
                }
            }
            const {data} = await searchWorkers(query)
            this.userList = data.records
        },
        async handleCurrentChange(e){
            console.log(e)
            this.GQbool = true
            this.GWbool = true
            this.entryList = []
            this.tableInfo = []
            this.tableData = []
            this.tableList = [] 
            this.createForm = Object.assign({},this.getUserList[e-1])
            if(this.createForm.rankOfPosition){  
                this.createForm.rankOfPosition == 1 ? this.createForm.rankOfPosition = '试用级'
                :this.createForm.rankOfPosition == 2 ? this.createForm.rankOfPosition = '初级'
                :this.createForm.rankOfPosition == 3 ? this.createForm.rankOfPosition = '中级'
                :this.createForm.rankOfPosition == 4 ? this.createForm.rankOfPosition = '高级'
                :this.createForm.rankOfPosition == 5 ? this.createForm.rankOfPosition = '师傅级':''
            }
            if(this.getUserList[e-1].state == '专业'){
                this.ferState = this.getUserList[e-1].state
            }else{
                this.ferState = Number(this.getUserList[e-1].state)
            }
            console.log(this.ferState)
            if(this.createForm.type == 11 && this.ferState >= 1){  //新人入职
                let query = {
                page: 1,
                limit: 10000,
                userName: this.createForm.userName,
                jobNumber: this.createForm.jobNumber,
                trainingCategory: '入职培训',
                noState:'结束'
                }
                const res = await recordFind(query)
                this.entryList = res.data.list
            }
            if(this.createForm.type == 11 && this.ferState >= 3){  //新人入职
                let query = {
                page: 1,
                limit: 10000,
                userName: this.createForm.userName,
                jobNumber: this.createForm.jobNumber,
                trainingCategory: '岗前培训',
                noState:'结束'
                }
                const res = await recordFind(query)
                this.tableInfo = res.data.list
            }
            if(this.ferState >= 5){
                let query = {
                page: 1,
                limit: 10000,
                userName: this.createForm.userName,
                jobNumber: this.createForm.jobNumber,
                trainingCategory: '岗位培训',
                noState:'结束'
                }
                const res = await recordFind(query)
                this.tableData = res.data.list
            }
            if(this.ferState >= 7){ 
                let query = {
                page: 1,
                limit: 10000,
                userName: this.createForm.userName,
                jobNumber: this.createForm.jobNumber,
                trainingCategory: '岗位实操培训',
                noState:'结束'
                }
                const res = await recordFind(query)
                this.tableList = res.data.list
            }
            if(this.ferState == '专业'){
                this.ferState = 3
                let query = {
                page: 1,
                limit: 10000,
                userName: this.createForm.userName,
                jobNumber: this.createForm.jobNumber,
                trainingCategory: '专业培训',
                noState:'结束'
                }
                const res = await recordFind(query)
                this.tableData = res.data.list
            }
            console.log(this.createForm.type)
            this.total = this.getUserList.length
        },
        // 点击岗位前完成培训
        skipTrain(e){
            let query = {
                type:'入职',
                name:this.createForm.userName,
            }
            const souceType =  this.createForm.type == 11 ? '入职培训' : this.createForm.type == 111 ? '定期培训' : this.createForm.type == 1111 ? '外部培训' : ''
            if(e == '入职培训'){
                if(!this.entryList.length) return this.$message.error('没有培训计划列表！')
                query.trainingCategory = this.entryList[0].trainingCategory
                query.souceType = souceType
            }else if(e == '岗前培训'){
                if(!this.tableInfo.length) return this.$message.error('没有培训计划列表！')
                query.trainingCategory = this.tableInfo[0].trainingCategory
                query.souceType = souceType
            }else if(e == '岗位培训' || e == '专业培训'){
                if(!this.tableData.length) return this.$message.error('没有培训计划列表！')
                query.trainingCategory = this.tableData[0].trainingCategory
                query.souceType = souceType
            }else if(e == '岗位实操培训'){
                if(!this.tableList.length) return this.$message.error('没有培训计划列表！')
                query.trainingCategory = this.tableList[0].trainingCategory
                query.souceType = souceType
            }
            this.$router.push({ path: '/knowledgeSkill/trainingResults', query: query})
        },
        setNowTime() {
            let date = new Date()
            // 获取年、月、日、时、分、秒  
            const year = date.getFullYear();  
            const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的  
            const day = String(date.getDate()).padStart(2, '0');  
            const hour = String(date.getHours()).padStart(2, '0');  
            const minute = String(date.getMinutes()).padStart(2, '0');  
            const second = String(date.getSeconds()).padStart(2, '0');  
            return `${year}-${month}-${day} ${hour}:${minute}:${second}`;   
        },
        // 点击岗前培训按钮
        async trainingClick(e){
            this.trainingCategory = e
            let query = {
                page:1,
                limit:10000,
                userKnowledgePostId: this.createForm.userKnowledgePostId, 
                trainingCategory: this.trainingCategory
            }
            const res = await programFind(query)
            if(!res.data.list.length) return this.$message.error('没有培训计划列表！')
            this.trainingList = res.data.list
            this.trainingShow = true
        },
        // 选择培训计划点击确定
        async trainingAffirm(){
            if(this.trainingCategory == '入职培训'){
                this.GQbool = true
                this.ferState = 1
                let objectMap = []
                this.rowSelect2.forEach(async item =>{
                    objectMap.push({
                        userName: this.createForm.userName, 
                        jobNumber: this.createForm.jobNumber,
                        workCenter: this.createForm.workCenter,
                        jobCategory: this.createForm.jobCategory,
                        jobTitle: this.createForm.jobTitle,
                        userKnowledgePostId:this.createForm.userKnowledgePostId,
                        trainingContent: item.trainingContent,    
                        trainingInstructor:item.userName,
                        trainingCategory:item.trainingCategory,
                        evaluationMode:item.evaluationMode,
                        trainingTime: this.setNowTime(),
                        contentType:item.contentType,
                        souceType:this.createForm.type == 11 ? '入职培训' : this.createForm.type == 111 ? '定期培训' : this.createForm.type == 1111 ? '外部培训' : '',
                        userKnowledgeTrainingProgramId: item.id,  // 培训计划id
                        type:this.createForm.type,  // 1.入职与培训2.晋级管理3.转岗管理4.关键工序管理
                        state:1,          // 默认传状态
                    })
                })
                const res = await recordSaveList({objectMap:objectMap})
                if(res.code == 500) return
                if(res.code != '1') return this.$message.error(res.msg)
                this.trainingShow = false
                setTimeout(async () =>{
                    let query = {
                        page:1,
                        limit:10000,
                        userName:this.createForm.userName,
                        jobNumber:this.createForm.jobNumber,
                        trainingCategory: '入职培训',
                        noState:'结束'
                    }
                    const res = await recordFind(query)
                    this.entryList = res.data.list
                },500)
            } else if(this.trainingCategory == '岗前培训'){
                this.GQbool = true
                this.ferState = 3
                let objectMap = []
                this.rowSelect2.forEach(async item =>{
                    objectMap.push({
                        userName: this.createForm.userName, 
                        jobNumber: this.createForm.jobNumber,
                        workCenter: this.createForm.workCenter,
                        jobCategory: this.createForm.jobCategory,
                        jobTitle: this.createForm.jobTitle,
                        userKnowledgePostId:this.createForm.userKnowledgePostId,
                        trainingContent: item.trainingContent,    
                        trainingInstructor:item.userName,
                        trainingCategory:item.trainingCategory,
                        evaluationMode:item.evaluationMode,
                        trainingTime:this.setNowTime(),
                        contentType:item.contentType,
                        souceType:this.createForm.type == 11 ? '入职培训' : this.createForm.type == 111 ? '定期培训' : this.createForm.type == 1111 ? '外部培训' : '',
                        userKnowledgeTrainingProgramId: item.id,  // 培训计划id
                        type:this.createForm.type,  // 1.入职与培训2.晋级管理3.转岗管理4.关键工序管理
                        state:3,          // 默认传状态
                    })
                })
                const res = await recordSaveList({objectMap:objectMap})
                if(res.code == 500) return
                if(res.code != '1') return this.$message.error(res.msg)
                this.trainingShow = false
                setTimeout(async () =>{
                    let query = {
                        page:1,
                        limit:10000,
                        userName:this.createForm.userName,
                        jobNumber:this.createForm.jobNumber,
                        trainingCategory: '岗前培训',
                        noState:'结束'
                    }
                    const res = await recordFind(query)
                    this.tableInfo = res.data.list
                },500)
            } else if(this.trainingCategory == '岗位培训'){
                this.GWbool = true
                this.ferState = 5
                let objectMap = []
                this.rowSelect2.forEach(async item =>{
                    objectMap.push({
                        userName: this.createForm.userName, 
                        jobNumber: this.createForm.jobNumber,
                        workCenter: this.createForm.workCenter,
                        jobCategory: this.createForm.jobCategory,
                        jobTitle: this.createForm.jobTitle,
                        userKnowledgePostId:this.createForm.userKnowledgePostId,
                        trainingContent: item.trainingContent,    
                        trainingInstructor:item.userName,
                        trainingCategory:item.trainingCategory,
                        evaluationMode:item.evaluationMode,
                        trainingTime:this.setNowTime(),
                        contentType:item.contentType,
                        souceType:this.createForm.type == 11 ? '入职培训' : this.createForm.type == 111 ? '定期培训' : this.createForm.type == 1111 ? '外部培训' : '',
                        userKnowledgeTrainingProgramId: item.id,  // 培训计划id
                        type:this.createForm.type,  // 1.入职与培训2.晋级管理3.转岗管理4.关键工序管理
                        state: 5,          // 默认传状态
                    })
                })
                const res = await recordSaveList({objectMap:objectMap})
                if(res.code == 500) return
                if(res.code != '1') return this.$message.error(res.msg)
                this.trainingShow = false
                setTimeout(async () =>{
                    let query = {
                        page: 1,
                        limit: 10000,
                        userName: this.createForm.userName, 
                        jobNumber: this.createForm.jobNumber,
                        trainingCategory: '岗位培训',
                        noState:'结束'
                    }
                    const res = await recordFind(query)
                    this.tableData = res.data.list
                },500)
            } else if(this.trainingCategory == '岗位实操培训'){
                this.GWbool = true
                this.ferState = 7   
                let objectMap = []
                this.rowSelect2.forEach(async item =>{
                    objectMap.push({
                        userName: this.createForm.userName, 
                        jobNumber: this.createForm.jobNumber,
                        workCenter: this.createForm.workCenter,
                        jobCategory: this.createForm.jobCategory,
                        jobTitle: this.createForm.jobTitle,
                        userKnowledgePostId:this.createForm.userKnowledgePostId,
                        trainingContent: item.trainingContent,    
                        trainingInstructor:item.userName,
                        trainingCategory:item.trainingCategory,
                        evaluationMode:item.evaluationMode,
                        trainingTime:this.setNowTime(),
                        contentType:item.contentType,
                        souceType:this.createForm.type == 11 ? '入职培训' : this.createForm.type == 111 ? '定期培训' : this.createForm.type == 1111 ? '外部培训' : '',
                        userKnowledgeTrainingProgramId: item.id,  // 培训计划id
                        type:this.createForm.type,  // 1.入职与培训2.晋级管理3.转岗管理4.关键工序管理
                        state:7,          // 默认传状态
                    })
                })
                const res = await recordSaveList({objectMap:objectMap})
                if(res.code == 500) return
                if(res.code != '1') return this.$message.error(res.msg)
                this.trainingShow = false
                setTimeout(async () =>{
                    let query = {
                        page: 1,
                        limit: 10000,
                        userName: this.createForm.userName, 
                        jobNumber: this.createForm.jobNumber,
                        trainingCategory: '岗位实操培训',
                        noState:'结束'
                    }
                    const res = await recordFind(query)
                    this.tableList   = res.data.list
                },500)
            } else if(this.trainingCategory == '专业培训'){
                this.GWbool = true
                this.ferState = '专业'
                let objectMap = []
                this.rowSelect2.forEach(async item =>{
                    objectMap.push({
                        userName: this.createForm.userName, 
                        jobNumber: this.createForm.jobNumber,
                        workCenter: this.createForm.workCenter,
                        jobCategory: this.createForm.jobCategory,
                        jobTitle: this.createForm.jobTitle,
                        userKnowledgePostId:this.createForm.userKnowledgePostId,
                        trainingContent: item.trainingContent,    
                        trainingInstructor:item.userName,
                        trainingCategory:item.trainingCategory,
                        evaluationMode:item.evaluationMode,
                        trainingTime:this.setNowTime(),
                        contentType:item.contentType,
                        souceType:this.createForm.type == 11 ? '入职培训' : this.createForm.type == 111 ? '定期培训' : this.createForm.type == 1111 ? '外部培训' : '',
                        userKnowledgeTrainingProgramId: item.id,  // 培训计划id
                        type:this.createForm.type,  // 1.入职与培训2.晋级管理3.转岗管理4.关键工序管理
                        state:'专业',          // 默认传状态
                    })
                })
                const res = await recordSaveList({objectMap:objectMap})
                if(res.code == 500) return
                if(res.code != '1') return this.$message.error(res.msg)
                this.trainingShow = false
                setTimeout(async () =>{
                    let query = {
                        page: 1,
                        limit: 10000,
                        userName: this.createForm.userName, 
                        jobNumber: this.createForm.jobNumber,
                        trainingCategory: '专业培训',
                        noState:'结束'
                    }
                    const res = await recordFind(query)
                    this.tableData = res.data.list
                },500)
            }
            // 状态缓存
            this.getUserList.forEach((item,index) =>{
                if(item.id == this.createForm.id){
                    this.$set(this.getUserList[index],'state',this.ferState)
                }
            })
        },
         // 获取岗位
        async getjobTitle(){
            let query = {page:1,  limit:10000}
            if(this.createForm.nowJobCategory){query.jobCategory = this.createForm.nowJobCategory}
            if(this.createForm.nowWorkCenter){query.workCenter = this.createForm.nowWorkCenter}
            const res = await knowledgeFind(query)
            this.jobTitleList = res.data.list
            if(!res.data.list.length) return this.$message.error('工作中心和岗位类别未查询到数据!')
    },
        async getData(){
            if(!this.createForm.userName || !this.createForm.jobNumber) return this.$message.error('请填写姓名或工号!')
            let query ={
                page: 1,
                limit: 10,
                status:1,
                userName: this.createForm.userName,
                jobNumber: this.createForm.jobNumber
            }
            const res = await searchWorkers(query)
            // if(!res.data.records.lenght) return 
            this.userInfo = res.data.records[0]
            this.$set(this.createForm, 'originalWorkCenter', this.userInfo.departmentName)
            this.$set(this.createForm, 'originalParentNumber', this.userInfo.parentNumber)
            this.$set(this.createForm, 'originalUserName', this.userInfo.parentName)
            this.$set(this.createForm, 'originalJobCategory', this.userInfo.userKnowledgePost.jobCategory)
            this.$set(this.createForm, 'originalJobTitle', this.userInfo.userKnowledgePost.jobTitle)
            this.$set(this.createForm, 'originalUserKnowledgePostId', this.userInfo.userKnowledgePost.id)
        },
        async handleFilter(){
            this.entryList = []
            this.tableInfo = []
            this.tableData = []
            this.tableList = [] 
            let query = {
                // page:1,
                // limit:10000,
                type:'1,11,111,1111',
                noState:'结束',
                jobNumber: this.tiemJobNumber 
            }
            const res = await findByUser(query)
            console.log('res',res)
            this.getUserList = res.data.list
            if(this.getUserList.length){
            this.createForm = Object.assign({},this.getUserList[0])
            if(this.createForm.rankOfPosition){  
                this.createForm.rankOfPosition == 1 ? this.createForm.rankOfPosition = '试用级'
                :this.createForm.rankOfPosition == 2 ? this.createForm.rankOfPosition = '初级'
                :this.createForm.rankOfPosition == 3 ? this.createForm.rankOfPosition = '中级'
                :this.createForm.rankOfPosition == 4 ? this.createForm.rankOfPosition = '高级'
                :this.createForm.rankOfPosition == 5 ? this.createForm.rankOfPosition = '师傅级':''
            }
            if(this.getUserList[0].state == '专业'){    
                this.ferState = this.getUserList[0].state
            }else{
                this.ferState = Number(this.getUserList[0].state)
            }
            // this.currentPage1 = this.getUserList.length
            console.log(this.ferState)  
            if(this.createForm.type == 11 && this.ferState >= 1){  //新人入职
                let query1 = {
                page: 1,
                limit: 10000,
                userName: this.createForm.userName,
                jobNumber: this.createForm.jobNumber,
                trainingCategory: '入职培训',
                noState:'结束'
                }
                const res1 = await recordFind(query1)
                this.entryList = res1.data.list

                let query = {
                page: 1,
                limit: 10000,
                userName: this.createForm.userName,
                jobNumber: this.createForm.jobNumber,
                trainingCategory: '岗前培训',
                noState:'结束'
                }
                const res = await recordFind(query)
                this.tableInfo = res.data.list
            }
            if(this.ferState >= 5){ 
                let query = {
                page: 1,
                limit: 10000,
                userName: this.createForm.userName,
                jobNumber: this.createForm.jobNumber,
                trainingCategory: '岗位培训',
                noState:'结束'
                }
                const res = await recordFind(query)
                this.tableData = res.data.list
            }
            if(this.ferState >= 7){ 
                let query = {
                page: 1,
                limit: 10000,
                userName: this.createForm.userName,
                jobNumber: this.createForm.jobNumber,
                trainingCategory: '岗位实操培训',
                noState:'结束'
                }
                const res = await recordFind(query)
                this.tableList = res.data.list
            }
            if(this.ferState == '专业'){    
                this.ferState = 3
                let query = {
                page: 1,
                limit: 10000,
                userName: this.createForm.userName,
                jobNumber: this.createForm.jobNumber,
                trainingCategory: '专业培训',
                noState:'结束'
                }
                const res = await recordFind(query)
                this.tableData = res.data.list
            }
            this.total = this.getUserList.length
                // if(this.getUserList[this.getUserList.length-1].state != '发起中'){
                //     this.ferState = Number(this.getUserList[this.getUserList.length-1].state)
                //     if(this.ferState >= 3){
                //         let query = {
                //         page: 1,
                //         limit: 10000,
                //         userName: this.createForm.userName,
                //         jobNumber: this.createForm.jobNumber,
                //         trainingCategory: '岗前培训'
                //         }
                //         const res = await recordFind(query)
                //         this.tableInfo = res.data.list
                //     }
                //     // 获取岗位列表
                //     if(this.ferState >= 5){
                //         let query = {
                //         page: 1,
                //         limit: 10000,
                //         userName: this.createForm.userName,
                //         jobNumber: this.createForm.jobNumber,
                //         trainingCategory: '岗位培训'
                //         }
                //         const res = await recordFind(query)
                //         this.tableData = res.data.list
                //     }
                //     if(this.createForm.nowParentAudit == '同意' && this.createForm.originalParentAudit == '同意'){
                //         if(this.ferState < 3){this.GQbool = false}
                //         if(this.ferState == 4 || (this.createForm.originalWorkCenter == this.createForm.nowWorkCenter && this.ferState == 2) ){this.GWbool = false}
                //     }
                // }else{
                //     if(this.createForm.nowParentAudit == '同意' && this.createForm.originalParentAudit == '同意'){
                //         this.ferState = 2
                //         this.GQbool = false
                //         if(this.ferState == 4 || (this.createForm.originalWorkCenter == this.createForm.nowWorkCenter && this.ferState == 2) ){this.GWbool = false}
                //     }
                // }
                // this.total = this.getUserList.length
            }
        },
        async getPrinter(){
            const data = await findZplPrinterInfoList()
            if(data.code == '1'){
                this.printerNameList = JSON.parse(JSON.stringify(data.data))
                this.printerNameList.forEach((item,index) =>{
                    if(item.indexOf('\\\\')>=0){
                       this.printerNameList[index] = item.split('\\')[3]
                    }
                })
                console.log(this.printerNameList)
            }
        },
    },
    // 进入页面获取table信息
    mounted() {
        this.handleFilter()
    }
}
</script>

<style lang="scss" scoped>
.app-container{
    margin: 10px;
}
/deep/ .el-table__header .el-table-column--selection .cell .el-checkbox:after {
  content: "全选";
  margin-left: 5px;
}
</style>
